function formAjax(form, url,callback) {
    callback = callback ? callback : showResponse;
    $(form).ajaxSubmit({
        beforeSubmit: showRequest,
        success: callback,
        error: showError,
        url: url,
        type: "post",
        dataType: "json",
        timeout: 60000
    });
}


//提交前动作
function showRequest(formData, jqForm, options) {
    click = 1;
    layer.msg('提交中，请稍后', {'time': 0, 'shade': [0.1, '#393D49'], 'icon': 16});
    $(".btnLogin").css("background", "#ccc").prop("disabled", true);
}

//成功后动作
function showResponse(data) {
    layer.closeAll();
    if (data.code == 1) {
        layer.msg(data.msg,{icon:1,time:2000},function(){
            location.href=data.url;
        });
    } else {
        layer.msg(data.msg, {icon: 5, time: 1000});
    }
}
//错误
function showError(XMLHttpRequest, textStatus, errorThrown) {
    layer.closeAll();
    layer.msg("状态：" + textStatus + "；出错提示：" + errorThrown, {shift: 6, icon: 5});
}